/*
 * Copyright (c) 2023, 2023,yzc.cn All rights reserved.
 *
 */
package cn.yzc.controller;

import cn.yzc.pojo.Result;
import cn.yzc.service.PersonnelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.view.RedirectView;

import javax.servlet.http.HttpSession;
import java.util.Map;

/**
 * <p>Project: SpringMVCPro - PersonnelController</p>
 * <p>Powered by yzc On 2023-10-30 19:12:24</p>
 * <p>描述：<p>
 *
 * @author yzc [yzc0415@126.com]
 * @version 1.0
 * @since 17
 */

@RestController

@RequestMapping("/user")
public class PersonnelController {
    @Autowired
    PersonnelService personnelService;

    @PostMapping(value = "/login",produces = {"application/json;charset=UTF-8"})
    public Result login( String account, String password){
        Map<String, String> map = personnelService.queryLogin(account, password);
        if (map.isEmpty())
            return Result.error("账号密码错误");
        return Result.success(map);
    }
   /* public RedirectView login(String account, String password){
        Map<String, String> map = personnelService.queryLogin(account, password);
        if (map.isEmpty())
            //账号密码错误，重定向到登录页面
            return new RedirectView("/login.html");
        //登录成功，将数据存储在Session中界面

        return new RedirectView("/index.html");
    }*/
}
